<?php
class Modelpoint extends ModelBase {
	
	protected $tablename = 'view_point';
	/**
	 *
	 * @var CDbConnection
	 */
	function __construct() {
		parent::__construct ();
	}
	
	// 得到兴趣点列表
	public function getPoint($page,$wherearr=0) {
		$blimit = $page * PERPAGE;
		$array = array ();
		$array = parent::getTable($this->tablename,$wherearr,$blimit,PERPAGE,' order by point_id desc');
		return $array;
	}
	
	// 到景点列表
	function getTable($where) {
		return parent::getTable ( $this->tablename, $where );
	}
	
	function getRcount($wherearr=0) {
		return parent::getRcount ( $this->tablename,$wherearr );
	}
	
	
	// 除景点
/* function delTable($where) {
		return parent::deleteTable ( $this->tablename, $where );
	
	} */
	
	function delTable($wherearr){
		$addarr['action'] = 'delete';
		$addarr['update_time']=time();
		return parent::updateTable($this->tablename, $addarr, $wherearr) ;
	}
	
	// 加或修改景点
	function replaceTable($updatear) {
		$updatear ['data'] ['update_time'] = time ();
		return parent::replaceTable ( $this->tablename, $updatear ['data'] );
	}
	
	function updateTable($addarr,$wherearr){
		$addarr['action'] = 'update';
		$addarr['update_time']=time();
		return parent::updateTable($this->tablename, $addarr, $wherearr) ;
	}

}
?>
